package com.test.personalblogproject.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.test.personalblogproject.pojo.FavoritesItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FavoritesItemMapper extends BaseMapper<FavoritesItem> {

    @Select("SELECT COUNT(*) FROM favorites_item WHERE user_id = #{userId} AND article_id = #{articleId}")
    int isArticleCollected(String userId,Long articleId);


    @Select(("SELECT article_id FROM favorites_item WHERE user_id = #{userId} AND collection_id = #{collectionId}"))
    List<Long> viewArticlesUnderTheCollectionList(String userId, Long collectionId);

}
